import java.util.concurrent.atomic.AtomicInteger;

import RobotPkg.Engine;
import RobotPkg.IEngineListener;


public class EngineListener implements IEngineListener {

	AtomicInteger wheelVect;
	Engine engine;
	public EngineListener(AtomicInteger wheelVect, Engine engine) {
		this.wheelVect = wheelVect;
		this.engine = engine;
	}
	@Override
	public void back() {
		wheelVect.set(-engine.getSpeed());
		System.out.println(engine+" back "+engine.getSpeed());
	}

	@Override
	public void go() {
		wheelVect.set(engine.getSpeed());
		System.out.println(engine+" go "+engine.getSpeed());

	}

	@Override
	public void stop() {
		wheelVect.set(0);
		System.out.println(engine+" stop "+engine.getSpeed());
	}

}
